package com.baseframe.launch.props;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.EnvironmentAware;
import org.springframework.core.env.Environment;
import org.springframework.core.env.EnvironmentCapable;
import org.springframework.lang.NonNull;

@ConfigurationProperties("base")
public class BaseProperties implements EnvironmentAware, EnvironmentCapable {

    @Getter
    @Setter
    private String env;

    @Getter
    @Setter
    private String name;

    private  Environment environment;

    @Override
    public void setEnvironment(@NonNull Environment environment) {
        this.environment = environment;

    }

    @NonNull
    @Override
    public Environment getEnvironment() {
        return environment;
    }

    public String getApplicationName(){

        return getEnvironment().getProperty("spring.application.name");
    }

    public String getProfilesEnv(){
        return getEnvironment().getProperty("spring.profiles.active");
    }



}
